<?php

namespace App\Service\Common;

use App\Service\System\SystemNotifyService;
use Illuminate\Support\Facades\Log;

class InformationService
{

    /**
     * 夸父商家通用消息通知
     * @param $title
     * @param $notifyType
     * @param $target
     * @param $sms
     * @param $url
     * @param $methodType
     * @param $summary
     * @param $content
     * @param $isPopup
     * @param $presenceArea
     * @param $pushInfo
     * @param $shopId
     * @return void
     */
    public static function appBasePush(
        $title,
        $notifyType,
        $target,
        $sms,
        $url,
        $methodType,
        $summary,
        $content,
        $isPopup,
        $presenceArea,
        $pushInfo,
        $shopId
    ) {
        $notify = SystemNotifyService::save(
            false,
            $title,
            $notifyType,
            $target,
            $sms,
            $title,
            $url,
            $methodType,
            $summary,
            $content,
            $isPopup,
            $presenceArea,
            $shopId
        );
        SystemNotifyService::recordLog($notify, '创建消息');
        foreach ($pushInfo as $value) {
            SystemNotifyService::preSend($notify->id, [$value]);
            Log::info('已给用户ID为' . $value . ' 推送消息消息');
        }
    }


}
